<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .base-style {
            width: 100px;
            height: 100px;
            border-radius: 50%;
        }

        .red {
            background-color: red;
        }

        .yellow {
            background-color: yellow;
        }

        .green {
            background-color: green;
        }
    </style>
</head>

<body>
    <main id="app">
        <div :class="classObj"></div>
    </main>
</body>
<script src="../../vue.js"></script>
<script>
    let vue = new Vue({
        el: "#app",
        data: {
            classObj: {
                'base-style': true,
                red: true,
                yellow: false,
                green: false
            }
        },
    })

    let times = [1500, 500, 1500];
    // let colors = ["red", "yellow", "green"];
    let index = 1;
    setInterval(() => {
        if (index == 0) {
            vue.classObj.red = true;
            vue.classObj.yellow = false;
            vue.classObj.green = false;
        } else if (index == 1) {
            vue.classObj.red = false;
            vue.classObj.yellow = true;
            vue.classObj.green = false;
        } else {
            vue.classObj.red = false;
            vue.classObj.yellow = false;
            vue.classObj.green = true;
        }
        index++;
        if (index >= times.length) {
            index = 0;
        }
    }, times[index])
</script>

</html>